import { userTypesAsync, userTypes } from "@redux/modules/user";
import { takeEvery, put } from "redux-saga/effects";
import { userApi } from "@api/modules";

function* loginAsync(action) {
  const res = yield userApi.login(action.login_value);
  yield put({
    type: userTypes.login,
    payload: res.data,
  });
}

function* watchUserSaga() {
  yield takeEvery(userTypesAsync.loginAsync, loginAsync);
}

export { watchUserSaga };
